#include "ChessBoard.h"


ChessBoard::ChessBoard(void)
{
}

ChessBoard::~ChessBoard(void)
{
}


void ChessBoard::Initialize()
{
	ClearBoardPieces();

	// clear the board
	for (int y = 0; y < HeightBoard; y++)
		for (int x = 0; x < WidthBoard; x++)
		{
			m_highlight[x][y] = false;
		}
}

unsigned char ChessBoard::GetBoardSpace(int x, int y)
{
	if (((x >= 0) && (x < WidthBoard)) && ((y >= 0) && (y < HeightBoard)))
		return m_board[x][y];
	else
		return PIECE_NONE;
}

void ChessBoard::SetBoardSpace(int x, int y, PieceType piece, char color)
{
	if (((x >= 0) && (x < WidthBoard)) && ((y >= 0) && (y < HeightBoard)))
	{
		m_board[x][y] = piece;
	}
}

void ChessBoard::EnableHighlight(int x, int y)
{
	if (((x >= 0) && (x < WidthBoard)) && ((y >= 0) && (y < HeightBoard)))
		m_highlight[x][y] = true;
}

void ChessBoard::DisableHighlight(int x, int y)
{
	if (((x >= 0) && (x < WidthBoard)) && ((y >= 0) && (y < HeightBoard)))
		m_highlight[x][y] = false;
}

bool ChessBoard::GetHighlight(int x, int y)
{
	if (((x >= 0) && (x < WidthBoard)) && ((y >= 0) && (y < HeightBoard)))
		return m_highlight[x][y];
	else
		return false;
}

void ChessBoard::ClearBoardPieces()
{
	// clear the board
	for (int y = 0; y < HeightBoard; y++)
		for (int x = 0; x < WidthBoard; x++)
		{
			m_board[x][y] = PIECE_NONE;
		}
}

void ChessBoard::Release()
{
}